package cn.lili.controller.feign;

import cn.lili.modules.broadcast.service.StudioCommodityService;
import cn.lili.modules.goods.client.StudioCommodityClient;
import cn.lili.modules.goods.entity.dos.StudioCommodity;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: ftyy
 * @date: 2022-01-17 16:06
 * @description: 描述
 */
@RestController
@RequiredArgsConstructor
public class StudioCommodityFeignController implements StudioCommodityClient {
    private final StudioCommodityService studioCommodityService;

    @Override
    public StudioCommodity getOne(Integer roomId, Integer goodsId) {
        return studioCommodityService.getOne(new LambdaQueryWrapper<StudioCommodity>().eq(StudioCommodity::getRoomId, roomId)
                .eq(StudioCommodity::getGoodsId, goodsId));
    }

    @Override
    public void save(StudioCommodity studioCommodity) {
        studioCommodityService.save(studioCommodity);
    }

    @Override
    public void remove(StudioCommodity studioCommodity) {
        studioCommodityService.remove(studioCommodity.lambdaQueryWrapper());
    }
}
